﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FutureOpen.Web.Pages;
using FutureOpen.Core;
using FutureOpen.Core.func;
using FutureOpen.Core.func.db;

public partial class MyJobTagsMgr : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        base.PageInit();
        LoadMyParams();
        if (!Page.IsPostBack)
        {
            if (IsLogin())
            {

                     MyTagJob mtj = new MyTagJob(this.MyUsr);
                    this.GridView1.DataSource = mtj.GetUsrTags();
                    this.GridView1.DataBind();
             
            }
        }

    }
    private void LoadMyParams()
    {
        string temp = Request.QueryString["t"];
        if (!string.IsNullOrEmpty(temp))
        {
            this.TextBox1.Text = HttpUtility.UrlDecode(temp); 
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (IsLogin())
        {
            string t = this.TextBox1.Text;
            if (!string.IsNullOrEmpty(t))
            {
                MyTagJob mtj = new MyTagJob(MyUsr);
                mtj.AddTag(t.Trim().ToLower());
                Page.Response.Redirect("MyJobTagsMgr.aspx");
            }
        }
    }

    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        if (IsLogin())
        {
            MyTagJob mtj = new MyTagJob(this.MyUsr);
            string tag = GridView1.DataKeys[e.RowIndex].Value.ToString();
            mtj.DelTagUsr(tag);
            Page.Response.Redirect("MyJobTagsMgr.aspx");
        }
    }
}
